package com.yjt.javatest.dao;

/**
 * @author fengye
 * @Date: 2022-07-16-21:14
 * @Description:
 */

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yjt.javatest.entity.Test;
import com.yjt.javatest.entity.vo.TestNameVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 添加了@Mapper注解之后这个接口在编译时会生成相应的实现类
 *
 * 需要注意的是：这个接口中不可以定义同名的方法，因为会生成相同的id
 * 也就是说这个接口是不支持重载的
 */
@Mapper
@Repository
public interface TestMapper extends BaseMapper<Test> {
    @Select("<script> " +
            "select test_id, title from test where test_id in " +
            "<foreach collection = 'testIds' item='item' open='(' separator = ',' close=')'>" +
            "#{item} " +
            "</foreach>" +
            "</script>")
    List<TestNameVo> getTestTitles(List<Integer> testIds);

}
